import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
var _excluded = ["message", "description"],
    _excluded2 = ["message", "description"],
    _excluded3 = ["message", "description"],
    _excluded4 = ["message", "description"];
import { notification } from 'antd';
import intl from "./intl";

/**
 * 操作成功通知提示
 * @function success
 * @param {NotificationOptions} options - 默认属性
 * @param {?string} [options.message=操作成功] - 提示信息
 * @param {?string} [options.description] - 详细描述
 */
function success(options) {
  var _ref = options || {},
      message = _ref.message,
      description = _ref.description,
      others = _objectWithoutProperties(_ref, _excluded);

  notification.success(_objectSpread({
    message: message || intl.get('cpaas.common.notification.success').d('操作成功'),
    description: description,
    duration: 2.5,
    className: 'success'
  }, others));
}
/**
 * 操作失败通知提示
 * @function error
 * @param {NotificationOptions} options - 默认属性
 * @param {?string} [options.message=操作失败] - 提示信息
 * @param {?string} [options.description] - 详细描述
 */


function error(options) {
  var _ref2 = options || {},
      message = _ref2.message,
      description = _ref2.description,
      others = _objectWithoutProperties(_ref2, _excluded2);

  notification.error(_objectSpread({
    message: message || intl.get('cpaas.common.notification.error').d('操作失败'),
    description: description,
    duration: 2.5,
    className: 'error'
  }, others));
}
/**
 * 操作异常通知提示
 * @function warning
 * @param {NotificationOptions} options - 默认属性
 * @param {?string} [options.message=操作异常] - 提示信息
 * @param {?string} [options.description] - 详细描述
 */


function warning(options) {
  var _ref3 = options || {},
      message = _ref3.message,
      description = _ref3.description,
      others = _objectWithoutProperties(_ref3, _excluded3);

  notification.warning(_objectSpread({
    message: message || intl.get('cpaas.common.notification.warn').d('操作异常'),
    description: description,
    duration: 2.5,
    className: 'warn'
  }, others));
}
/**
 * 操作信息通知提示
 * @function info
 * @param {NotificationOptions} options - 默认属性
 * @param {?string} [options.message] - 提示信息
 * @param {?string} [options.description] - 详细描述
 */


function info(options) {
  var _ref4 = options || {},
      message = _ref4.message,
      description = _ref4.description,
      others = _objectWithoutProperties(_ref4, _excluded4);

  notification.info(_objectSpread({
    message: message,
    description: description,
    duration: 2.5,
    className: 'info'
  }, others));
}

export default {
  success: success,
  error: error,
  warning: warning,
  info: info
};